mini.parse();

var editorId = "ke";

function MessageReplyFormHandler() {
}

MessageReplyFormHandler.instance = new MessageReplyFormHandler();
MessageReplyFormHandler.messageReplyForm = new mini.Form("messageReplyForm");
MessageReplyFormHandler.formData = {};

MessageReplyFormHandler.passData = function(data) {
	// 通过页面直接获取数据
	MessageReplyFormHandler.messageReplyForm.setData(data);
	editor.html(data.briContent);
}

MessageReplyFormHandler.update = function() {
	var briId = document.getElementById("briId").value;
	var briContent = editor.html();
	
	$.ajax({
				url : __rootUrl + "updateReply.do",
				type : "POST",
				data : {
					briId : briId,
					briContent : briContent,
					lslUser: gbOperateUser,
					lslAddress: gbOperateIp
				},
				cache : false,
				success : function(text) {
					mini.alert("回复成功", "系统提示", null);
				},
				error : function(jqXHR, textStatus, errorThrown) {
					mini.alert(jqXHR.responseText, "系统提示", null);
					CommentsHandler.closeCurrentWin();
				}
			});
}

/**
 * 关闭窗口
 * 
 * @param {}
 */
MessageReplyFormHandler.closeCurrentWin = function(action) {
	if (window.CloseOwnerWindow)
		window.CloseOwnerWindow(action);
	else
		window.close();
}

MessageReplyFormHandler.closeMiniWin = function() {
	MessageReplyFormHandler.closeCurrentWin("cancel");
	// miniWin.destroy();
}

try {
	var editor = KindEditor.create('#' + editorId, {
		resizeType : 1,
		uploadJson : "../../resource/kindeditor/jsp/upload_json.jsp?imgDir="
				+ __msgpath,
		fileManagerJson : '../../resource/kindeditor/jsp/file_manager_json.jsp',
		allowPreviewEmoticons : false,
		allowImageUpload : true,
		items : ['fontname', 'fontsize', '|', 'forecolor', 'hilitecolor',
				'bold', 'italic', 'underline', 'removeformat', '|',
				'justifyleft', 'justifycenter', 'justifyright',
				'insertorderedlist', 'insertunorderedlist', '|', 'emoticons',
				'image', 'link']
	});
} catch (e) {
}